Home About Assignments Final Project

Week 13:

For output devices i chose to make RGB circuit board, i've always inquired at my start at electornics how the RGB LED works! i made a mistake in this assignment which in coinsidence proofed the concept of Tri-LEDs (Red one, Green, and Blue) gathered in one unit.
First step was the circuit design (Schematic & Board), the components you need to make this circuit (Attiny45, 10K Resistor, 1uF Cap, 2 x 1k Resistors, 499 Ohm resistors, RGB LED, ISP Headers, 6-Pin Headers FTDI).


Next step is editing the pics with GIMP to export the traces and boarder files.

3rd Step is to mill the circuit using Fab Modules and 1/64 inches bit and to cut the boarders with 1/32 inches bit.
Next i soldered the components to the circuit and the problem i said i had in the circuit is i connected the green LED to pin 0 which is one of the Programming pins of the ISP, so my RGB LED turned into just GB LED ^_^

Last step is the programming.
THE CODE:
"
int prevR = 0, prevG = 0, prevB = 0; // all of the previous
RGB values
int const Red = 3; //pin 3
int const Blue = 5; // pin 4
int const Green = 6; // pin 5

void setup(){} // sets up the program
void loop() { //main loop of the program
RGB(255, 255, 255); // this calls the RGB function
delay(1000); //stays on white for one second
RGB(0, 0, 255);
delay(1000);
RGB(0,120,255);
delay(1000);
RGB(0, 255, 0);
delay(1000);
RGB(255, 0, 255);
delay(10);
RGB(0,0,0);
delay(1000);

}

void RGB(int R, int G, int B) {
for (int i = 0; i <= 255; i++)
{
if (i >= prevR - R && prevR < R) {
analogWrite(Red, prevR + i);
}
if (i >= prevG - G && prevG < G) {
analogWrite(Green, prevG + i);
}
if (i >= prevB - B && prevB < B) {
analogWrite(Blue, prevB + i);
}
//delay(10);
//}
//for (int i = 0; i <= 255; i++)
//{
if (i >= R - prevR && prevR > R) {
analogWrite(Red, prevR - i);
}
if (i >= G - prevG && prevG > G) {
analogWrite(Green, prevG - i);
}
if (i >= B - prevB && prevB > B) {
analogWrite(Blue, prevB - i);

}
delay(10);
}
delay(10);
analogWrite(Red, R);
analogWrite(Green, G);
analogWrite(Blue, B);
prevR = R;
prevG = G;
prevB = B;
}
"


VIDEO

DOWNLOAD FILES